import {request, requestMock} from '@util/http/index';


export const  NavTypeRequest = ()=>{
return  request.get('/api/product/getBaseCategoryList')
}

export const requestBannerList = ()=>{
    return requestMock.get('/banner')
}

export const requestFloorList = ()=>{
    return requestMock.get('/floor')
}

// 搜索商品请求
export const searchGoodsRequest = (params)=>{
    return request.post('/api/list',params)
}   

// 商品详情请求
export const goodsDetailRequest = (skuId)=>{
    return request.get(`/api/item/${skuId}`)
}

// 添加商品进入购物车(修改已有商品的数量)
export const addCartSuccessRequest = ({skuId,skuNum})=>{
    // console.log(skuId,skuNum)
    return request.post(`/api/cart/addToCart/${ skuId }/${ skuNum }`)
}

//获取购物列表数据
export const getShopCartListRequest = ()=>{
    return request.get('/api/cart/cartList')
}

// 切换商品选中状态请求
export const changeGoodsCheckedRequest = ({skuId,isChecked})=>{
    return request.get(`/api/cart/checkCart/${skuId}/${isChecked}`)
}

// 全部选中商品请求
export const chooseGoodsAllRequest = (isChecked,skuIdList)=>{
   return request.post(`/api/cart/batchCheckCart/${isChecked}`,skuIdList) 
}

// 删除商品详情信息
export const deleteGoodInfoRequest = (skuId)=>{
    return request.delete(`/api/cart/deleteCart/${skuId}`)
}

// 获取验证码请求
export const getAuthCodeRequest  = (phone)=>{
    return request.get(`/api/user/passport/sendCode/${phone}`)
}

// 注册用户
export const registerUserRequest = ({phone,password,code})=>{
    return request.post('/api/user/passport/register',{phone,password,code})
}

// 登录请求
export const loginRequest = ({phone,password})=>{
    return request.post('/api/user/passport/login',{phone,password})
}

// 登录以后获取用户信息
export const getUserInfoRequest = ()=>{
    return request.get('/api/user/passport/auth/getUserInfo')
}

// 退出登录
export const exitLoginRequest = ()=>{
    return  request.get('/api/user/passport/logout')
}

// 获取订单地址信息
export const getTradeAddressMsgRequest = ()=>{
    return requestMock.get('/address')
}

// 获取订单商品列表信息
export const getTradeGoodListRequest = ()=>{
    return request.get('/api/order/auth/trade')
}

// 提交订单请求
export const submitTradeRequest = (tradeNo,tradeInfo)=>{
    return request.post(`/api/order/auth/submitOrder?tradeNo=${tradeNo}`,tradeInfo)
}

// 获取订单支付信息
export const getTradeDtailMSgRequest = (orderId)=>{
    return request.get(`/api/payment/weixin/createNative/${orderId}`)
}

// 查询支付订单状态
export const searchTardePayState=(orderId)=>{
    return request.get(`/api/payment/weixin/queryPayStatus/${orderId}`)
}

// 获取我的订单列表
export const getMyTradeListRequest = ({page,limit})=>{
    return request.get(`/api/order/auth/${page}/${limit}`)
}